package util

import "github.com/gin-gonic/gin"

/*
*	@param data 1: key
* 	@param data 2: data
 */
func SuccessResponse(ctx *gin.Context, data ...interface{}) {
	if len(data) != 0 {
		ctx.JSON(200, gin.H{
			"status":         10000,
			"message":        "success",
			data[0].(string): data[1],
		})
		return
	}

	ctx.JSON(200, gin.H{
		"status":  10000,
		"message": "success",
	})
}

func FailedResponse(ctx *gin.Context, status int, message string) {
	ctx.JSON(200, gin.H{
		"status":  status,
		"message": message,
	})
}
